job compile(list inputs) {
  @{"gcc -c %s" % [(string)inputs[0]]};
}

void main(list args) {
  list my_servers = [ [ "host"=>"localhost",
                        "user"=>"dummy", 
                        "password"=>"dummypw" ] ];
  connect my_servers;
  
  list srcs = [[(file)"a.c"], [(file)"b.c"], [(file)"c.c"], [(file)"d.c"]];
  
  list output;
  int distcompile = push compile, null, srcs, output;
  wait distcompile;
  
  string ld = "gcc -o MyCoolProgram";
  
  for (int i = 0; i < length output; i = i + 1) {
    map out = (map)output[i];
    for (int j = 0; j < length (list)out["files"]; j = j + 1) {
      ld = "%s %s/%s" % [ld, (string)out["root"], (string)((list)out["files"])[j]];
    }
  }
  
  print(ld + "\n");
  @{ld};
}
